//module pattern
// 1) encapsulated objects
// 2)
var bankAccount = function(){
    var accountHolderSSN = 'xxx-xxx-xxxx';//private variable
    var accountHolderName = "john";
    var isAccountMatching = function(passedSSN){// public
        return passedSSN === accountHolderSSN;
    };
     return {
        accountMatch : isAccountMatching,
        accountHolderName : accountHolderName
    };

}();//iif (immedia
//revealing module pattern

var johnAccount = bankAccount;

johnAccount.accountMatch('sss-sss-ssss');

johnAccount.accountHolderName;//johnm
johnAccount.accountHolderSSN;//undefined
var sum = function(){
    return 10;
}
var total = sum();
var diff = function(a,b){
    b-a
    //return undefined
}

var final = diff(3,1);
//


var app = function(){

    var privateVariable = 'this is private variable';
    var publicVariable = 'this is public variable';

    var privateFunc = function(){
        // return privateVariable;
    }

    var publicFunc = function(){
        //this is exposed outside
    }


    var output =  {
        publicVariable : publicVariable,
        publicFunc : publicFunc
    };

    return output;
}

